/**
 * Copyright (c) 2015-2017, Henry Yang 杨勇 (gismail@foxmail.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mapfinal.server.mgrdb.model;

import java.util.Map;

import com.jfinal.kit.StrKit;
import com.lambkit.Lambkit;
import com.lambkit.common.service.ServiceKit;
import com.lambkit.db.mgr.IField;
import com.lambkit.db.sql.column.Column;
import com.mapfinal.server.MapfinalServerConfig;
import com.mapfinal.server.mgrdb.MfTableFieldService;
import com.mapfinal.server.mgrdb.service.impl.MfTableFieldServiceImpl;

/**
 * @author yangyong 
 * @website: www.lambkit.com
 * @email: gismail@foxmail.com
 * @date 2021-09-06
 * @version 1.0
 * @since 1.0
 */
public class MfTableField extends MfTableFieldBase<MfTableField> implements IField {

	private static final long serialVersionUID = 1L;
	
	public static MfTableFieldService service() {
		return ServiceKit.inject(MfTableFieldService.class, MfTableFieldServiceImpl.class);
	}
	
	public static MfTableFieldCriteria sql() {
		return new MfTableFieldCriteria();
	}
	
	public static MfTableFieldCriteria sql(Column column) {
		MfTableFieldCriteria that = new MfTableFieldCriteria();
		that.add(column);
        return that;
    }

	public MfTableField() {
		MapfinalServerConfig config = Lambkit.config(MapfinalServerConfig.class);
		String dbconfig = config.getDbConfig();
		if(StrKit.notBlank(dbconfig)) {
			this.use(dbconfig);
		}
	}
	
	@Override
	public Object getId() {
		// TODO Auto-generated method stub
		return getFldid();
	}

	@Override
	public String getAttrName() {
		// TODO Auto-generated method stub
		String name = getName();
		return StrKit.toCamelCase(name);
	}

	@Override
	public String getDefault() {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public String getDescript() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object getAttr(String key) {
		// TODO Auto-generated method stub
		return get(key);
	}

	@Override
	public void setAttr(String key, Object value) {
		// TODO Auto-generated method stub
		this.set(key, value);
	}

	@Override
	public void putAttr(String key, Object value) {
		// TODO Auto-generated method stub
		this.put(key, value);
	}

	@Override
	public Map<String, Object> getAttrs() {
		// TODO Auto-generated method stub
		return _getAttrs();
	}

	/*
	@Override
	public String getIsunsigned() {
		// TODO Auto-generated method stub
		return getUnsigned()==1 ? "Y" : "N";
	}

	@Override
	public String getIsnullable() {
		// TODO Auto-generated method stub
		return getNullable()==1 ? "Y" : "N";
	}

	@Override
	public String getIsai() {
		// TODO Auto-generated method stub
		return getAi()==1 ? "Y" : "N";
	}

	@Override
	public String getIskey() {
		// TODO Auto-generated method stub
		return getPkey()==1 ? "Y" : "N";
	}

	@Override
	public String getIsview() {
		// TODO Auto-generated method stub
		return getView()==1 ? "Y" : "N";
	}

	@Override
	public String getIsedit() {
		// TODO Auto-generated method stub
		return getEdit()==1 ? "Y" : "N";
	}

	@Override
	public String getIsselect() {
		// TODO Auto-generated method stub
		return getSearch()==1 ? "Y" : "N";
	}

	@Override
	public String getIsmustfld() {
		// TODO Auto-generated method stub
		return getMustfld()==1 ? "Y" : "N";
	}
	*/
	
}
